﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Platformer1
{
    class Ryu : Player
    {
        /// <summary>
        /// Constructors a new player.
        /// </summary>
        public Ryu(Level level, Vector2 position, PlayerIndex inPlayerIndex)
        {
            isPlayer = true;
            playerIndex = inPlayerIndex;
            Level = level;
            shootFrame = 5;

            LoadContent();

            Reset(position);
        }

        public Ryu() 
        {
            spriteType = SpriteType.ST_Player;
        }

        /// <summary>
        /// Loads the player sprite sheet and sounds.
        /// </summary>
        new public void LoadContent()
        {
            // Load animated textures.
            idleAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Idle"), 0.1f, true);
            runAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Run"), 0.1f, true);
            jumpAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Jump"), 0.1f, false);
            celebrateAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Celebrate"), 0.1f, false);
            dieAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Die"), 0.1f, false);
            punchAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Punch"), 0.1f, true, Level.Content.Load<Texture2D>("Sprites/Ryu/Punch_hit"), 1);
            jumpPunchAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Jump_Punch"), 0.1f, true, Level.Content.Load<Texture2D>("Sprites/Ryu/Jump_Punch_hit"), 0);
            kickAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Kick"), 0.1f, true, Level.Content.Load<Texture2D>("Sprites/Ryu/Kick_hit"), 1);
            jumpKickAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Jump_Kick"), 0.1f, true, Level.Content.Load<Texture2D>("Sprites/Ryu/Jump_Kick_hit"), 0);
            shootAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Shoot"), 0.075f, true);
            burningAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Ryu/Burning"), 0.075f, false);
            debug = Level.Content.Load<Texture2D>("debug");


            // Calculate bounds within texture size.
            int width = 75;
            int left = (idleAnimation.FrameWidth - width) / 2;
            int height = 96;
            int top = idleAnimation.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);

            headheight = height;
            bodywidth = width;

            LoadSoundEffects();
        }
    }
}
